home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
t_pent2.zip
/
PENT2.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1997-07-21
|
1KB
|
72 lines
Uses
Opstring;
Const
searchstr = #$f7+#$d0+#$f7+#$d2+#$b9+#$37+#$00+#$f7+#$f1;
bufsize = 32768;
Var
Table : BTable;
F : File;
Buf : Array[1..bufsize] of Char;
numread : Word;
count : Word;
Fixed : Word;
begin
Writeln;
Writeln('Pentium 2 Delay Bug Fixer, (Borland: CRT unit, TurboPower: OPCRT, APTIMER)');
Writeln;
If Paramcount=0 then
begin
Writeln('Syntax: Pent2 filename.exe');
Halt;
End;
Assign(F,Paramstr(1));
{$I-} Reset(F,1); {$I+}
if IOresult<>0 then
begin
Writeln('File not found!: '+ParamStr(1));
halt;
End;
Fixed:=0;
Bmmaketable(searchstr,table);
Writeln('Searching...'#10);
While Not eof(f) do
begin
Blockread(f,Buf,bufsize,numread);
Count:=BMSearch(Buf,Numread,Table,SearchStr);
If count<>$ffff then
Begin
Inc(Fixed);
Writeln('Fixed at byte position: ',Filepos(F)-Numread+Count+5);
Seek(F,Filepos(F)-Numread+Count+5);
Buf[1]:=#$7E;
BlockWrite(F,Buf,1);
End;
If Not Eof(f) Then Seek(F,Filepos(F)-length(Searchstr));
end;
Close(F);
If Fixed=0 Then
Begin
Writeln('Bug not found:'#10);
Writeln(' 1. Not using bad Delay function!');
Writeln(' 2. Already patched');
Writeln(' 3. EXE compressed');
End;
End.